/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { LegacyModuleTargetResImpl } from '../res/legacy-target-res-model-impl.js';
import { LegacyModuleTargetRes } from '../res/res-model.js';

import { CoreSourceSetImpl } from './core-source-set-impl.js';
import { LegacyTargetSourceSetModel } from './source-set-model.js';

export class LegacyTargetSourceSetImpl extends CoreSourceSetImpl implements LegacyTargetSourceSetModel {
  constructor(sourceSetRoot: string) {
    super(sourceSetRoot, new LegacyModuleTargetResImpl(sourceSetRoot));
  }

  getLegacyModuleTargetRes(): LegacyModuleTargetRes {
    return this.targetResModel as LegacyModuleTargetResImpl;
  }

  getTargetSourceSetModuleName(): string | undefined {
    return this.getLegacyModuleTargetRes()?.getConfigJsonOpt()?.module?.name;
  }
}
